/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.fiap.beans;

import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author eluquini
 */
@ManagedBean(name="quizz")
@SessionScoped
public class QuizzSimples {

    private ArrayList<Problema> problemas = new ArrayList<Problema>();
    private int score = 0;
    private int cont = 0;

    public int getScore() {
        return score;
    }
    public QuizzSimples(){
        problemas.add(new Problema("{3,1,4,1}",5));
        problemas.add(new Problema("{0,1,0,1}",0));

    }

    public String getSequencia(){
        String result;
        if(cont < problemas.size()){
            result = problemas.get(cont).getSequencia();
            cont++;
        }
        else{
            cont = 0;
            result = problemas.get(cont).getSequencia();
            cont++;
        }
        return result;
    }

    public String getResposta(){
        return "";
    }
    
    public void setResposta(String resposta){
        if(Integer.parseInt(resposta) == problemas.get(cont - 1).getSolução()){
            score++;
        }
    }
}
